package cn.laixueit.intercepter;

import cn.laixueit.pojo.Users;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MyIntecepter implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Users users = (Users) request.getSession().getAttribute("user");
        if(users!=null){
            return true;
        }
        response.sendRedirect("/schoolmanager_war_exploded/login.html");
        return false;
    }
}
